Do not call addListener in constructors of CCombo and StyledText #2733#2739
Conversation
Test Results 118 files ±0 118 suites ±0 16m 45s ⏱️ + 1m 2s Results for commit e60d395. ± Comparison against base commit 65ec239. This pull request skips 1 test.♻️ This comment has been updated with latest results. |
fe59a75 to
fd59b1a
Compare
|
Need to rethink this since the replacement is also official API and can therefore also be overridden |
19a9c1a to
887d96c
Compare
|
I've added 2 internal-API FTR the calls that I am correcting in this PR have been introduced recently: |
HeikoKlare
left a comment
There was a problem hiding this comment.
Maybe an unconventional thought on avoiding such a new API for just a very specific use case: what about wrapping the addListener calls into a display.asyncExec()? I think it's not necessary that the listeners are registered synchronously, so that could move it out of the constructor to avoid the potential problems with overwritten methods as well.
|
In principle it could work but I fear that it would mean that one needs to check for disposal when overriding the public |
Why should that be necessary? You would check for disposal before calling |
|
hm. on a second thought: consumers should be checking for disposal already. I mean the original
You're right, that would be easily solvable on my side by calling I'll adapt my PR with your suggestion 👍 |
887d96c to
aa30ff0
Compare
|
Adapted |
HeikoKlare
left a comment
There was a problem hiding this comment.
Except for the widget check, the change looks sound to me. @akoch-yatta what do you think? Do we miss anything?
aa30ff0 to
ad8479c
Compare
…lipse-platform#2733 The method is not final, which may cause issues if a subclass overrides it because it ends up being called upon instantiation, when the object is not fully initialized. Fixes eclipse-platform#2733
ad8479c to
e60d395
Compare
I think, it is fine |
The method is not final, which may cause issues if a subclass overrides it because it ends up being called upon instantiation, when the object is not fully initialized
Since these 2 classes are not in the same package as other subclasses of Widget, I had to resort to expanding the functionality in TypedListener.
Fixes #2733